home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Interactive Media Design Review 1999
/
Interactive Media Design Review 1999.iso
/
pc
/
Demos
/
Herois
/
Codigo.Cst
/
00067_Script_MenuPrincipal
< prev
next >
Wrap
Text File
|
1999-03-19
|
15KB
|
511 lines
property spr -- the spriteNum of me
property escondido -- Se esta escondido
property ativo -- Se mouse esta por cima do menu este esta ativo
property menuSel -- Opcao do menu selecionada
property subMenu -- Submenu aberto
property submenuSel -- Opcao dos submenus selecionada
property ligado
property x_ini, y_ini -- Quando desligado, aonde estava menu
property lado
on beginSprite me
-- Inicializacao
set ativo = false
set spr = the spriteNum of me
set ligado = true
set escondido = false
set the visibility of sprite (spr+1) to true
set menuSel = 0
set subMenu = 0
set submenuSel = 0
set lado = 0
-- Desliga outros menus
sendSprite(97,#chaveVisibilidade,false)
sendSPrite(97,#moveRelativo, 500,0)
-- Desliga opcoes ainda nao selecionadas desse menu
repeat with i = 3 to 7
set the visibility of sprite (spr+i) to false
end repeat
end
on moveDireitaEsquerda me
set d = the width of sprite spr
repeat with i = 3 to 7
set x = the locH of sprite (spr+i)
set dx = the width of sprite (spr+i)
set the locH of sprite (spr+i) to x - d - dx
end repeat
set lado = 1
end
on moveEsquerdaDireita me
set d = the width of sprite spr
repeat with i = 3 to 7
set x = the locH of sprite (spr+i)
set dx = the width of sprite (spr+i)
set the locH of sprite (spr+i) to x + d + dx
end repeat
set lado = 0
end
on decideEsquerdaDireita me
if the locH of sprite spr > 400 then
set l = 1
else
set l = 0
end if
if l <> lado then
if lado = 1 then
moveEsquerdaDireita me
else
moveDireitaEsquerda me
end if
end if
end
-- Mostra/esconde menu principal, fazendo sumir a parte debaixo
on mostraEsconde me
puppetSound 2, "Esconde"
if escondido then
-- Volta a mostrar
set escondido = false
set the visibility of sprite spr+1 to true
updateStage
else
-- Esconde
set escondido = true
if subMenu <> 0 then
set the visibility of sprite (subMenu+spr+3) to false
set subMenu = 0
end if
if the colorDepth > 8 then
set ini = the timer
global gCritico
set gCritico = gCritico + 1
repeat while (the timer - ini) < 100
set blend = 100 - (the timer - ini)
if blend < 0 then set blend = 0
set the blend of sprite (spr+1) to blend
updateStage
sendAllSprites(#idleSprite)
end repeat
set gCritico = gCritico - 1
set the blend of sprite (spr+1) to 100
end if
set the visibility of sprite spr+1 to false
updateStage
end if
end
-- Abre/Fecha animando bolinha
on abreFecha me
if ligado then
puppetSound 2,"Aciona"
-- Remove estado ativado (mouse sobre popup)
if ativo then
global gCritico
set gCritico = gCritico - 1
set ativo = false
set the member of sprite spr to member "MPTitulo: Desativado"
if not escondido then
set the member of sprite (spr+1) to member "MenuPrincipal: Desativado"
end if
end if
-- Desliga sprites
repeat with i = spr to spr+8
set the visibility of sprite i to false
end repeat
-- Movimenta bola
set x_fim = 67
set y_fim = 80
set x_ini = the locH of sprite (spr+9)
set y_ini = the locV of sprite (spr+9)
set x = x_ini
set y = y_ini
set dist = sqrt( (x_fim-x_ini) * (x_fim - x_ini) +¼
(y_fim-y_ini) * (y_fim - y_ini) )
set tempo = dist
if tempo > 30 then set tempo = 30
set tmp = the timer
repeat while tmp + tempo > the timer
set dist = (the timer - tmp) * 10000 / tempo
set novoy = sqrt(dist)*(y_fim - y_ini)/100 + y_ini
set novox = dist*(x_fim-x_ini)/10000 + x_ini
sendSprite(spr+2, #moveRelativo, novox-x, novoy-y)
set x = novox
set y = novoy
updateStage
end repeat
sendSprite(spr+2, #moveRelativo, x_fim - x, y_fim - y)
updateStage
set ligado = false
else
puppetSound 2, "Aciona"
-- Religa, primeiro movendo botao para lugar de origem
set x_fim = x_ini
set y_fim = y_ini
set x_ini = the locH of sprite (spr+9)
set y_ini = the locV of sprite (spr+9)
set x = x_ini
set y = y_ini
set dist = sqrt( (x_fim-x_ini) * (x_fim - x_ini) +¼
(y_fim-y_ini) * (y_fim - y_ini) )
set tempo = dist*2
if tempo > 20 then set tempo = 20
set tmp = the timer
repeat while tmp + tempo > the timer
set dist = (the timer - tmp) * 10000 / tempo
set novoy = sqrt(dist)*(y_fim - y_ini)/100 + y_ini
set novox = dist*(x_fim-x_ini)/10000 + x_ini
sendSprite(spr+2, #moveRelativo, novox-x, novoy-y)
set x = novox
set y = novoy
updateStage
end repeat
sendSprite(spr+2, #moveRelativo, x_fim - x, y_fim - y)
set ligado = true
set the visibility of sprite spr to true
set the visibility of sprite (spr+2) to true
if not escondido then set the visibility of sprite (spr+1) to true
updateStage
end if
end
-- Click no menu principal
on mouseUp me
cursor 4
sendSprite(spr, #idleSprite)
if menuSel = 0 then
-- Click no Titulo
set mh = the mouseH - the locH of sprite spr
if mh > 48 then
-- Click no mostra/esconde
mostraEsconde me
else
-- Click na bolinha, liga/desliga janela
abreFecha me
end if
else
puppetSound 2, "SomCliqueSimples"
-- Apresentacao
if menuSel = 1 then
if submenuSel = 0 then
if (subMenu <> 0) then
set the visibility of sprite (spr+subMenu+3) to false
set the visibility of sprite (spr+8) to false
end if
if (subMenu <> 4) then
set subMenu = 4
set the visibility of sprite (spr+7) to true
set the visibility of sprite (spr+8) to false
-- decideEsquerdaDireita me
else
set subMenu = 0
end if
else
set the visibility of sprite (spr+subMenu+3) to false
set the visibility of sprite (spr+8) to false
set subMenu = 0
-- Search generico
global gPronde, gDonde
set gPronde = 0
calculaDonde
if gDonde <> 0 then
sendAllSprites(#cleanSprite)
end if
sendSprite(112,#moveRelativo,18 - the locH of sprite 112,¼
167 - the locV of sprite 112)
case subMenuSel of
400:
go frame "Introducao"
401:
go frame "Help"
end case
end if
-- Criadores
else if menuSel =2 then
if (subMenu <> 0) then
set the visibility of sprite (spr+subMenu+3) to false
set the visibility of sprite (spr+8) to false
set subMenu = 0
end if
global gPronde
set gPronde = 1000
sendAllSprites(#cleanSprite)
calculaDonde
vaiCriadores 0
-- Revista heroi
else if menuSel = 3 then
if (subMenu <> 0) then
set the visibility of sprite (spr+subMenu+3) to false
set the visibility of sprite (spr+8) to false
set subMenu = 0
end if
global gPronde
set gPronde = 2000
sendAllSprites(#cleanSprite)
calculaDonde
go frame "Melhores Momentos"
-- Searches
else if menuSel = 6 then
if submenuSel = 0 then
if (subMenu <> 0) then
set the visibility of sprite (spr+subMenu+3) to false
end if
if (subMenu <> 1) then
set subMenu = 1
set the visibility of sprite (spr+4) to true
else
set subMenu = 0
end if
else
set the visibility of sprite (spr+subMenu+3) to false
set the visibility of sprite (spr+8) to false
set subMenu = 0
-- Search generico
case subMenuSel of
100:
sendSprite(97,#chaveVisibilidade,true)
sendSprite(97,#setEstado,0)
101:
sendSprite(97,#chaveVisibilidade,true)
sendSprite(97,#setEstado,1)
102:
sendSprite(97,#chaveVisibilidade,true)
sendSprite(97,#setEstado,2)
end case
end if
-- Universos
else if menuSel = 4 then
if submenuSel = 0 then
if (subMenu <> 0) then
set the visibility of sprite (spr+subMenu+3) to false
set the visibility of sprite (spr+8) to false
end if
if (subMenu <> 2) then
set subMenu = 2
set the visibility of sprite (spr+5) to true
set the visibility of sprite (spr+8) to false
else
set subMenu = 0
end if
else
-- Vai para universo
set universos = [7, 4, 3, 2, 1, 5,6]
set tmp = getAt(universos,subMenuSel - 199)
set the visibility of sprite (spr+subMenu+3) to false
set the visibility of sprite (spr+8) to false
set subMenu = 0
set subMenuSel = 0
sendSprite 120, #comecaAnima
updateStage
global gPronde
set gPronde = 1
calculaDonde
sendAllSprites(#cleanSprite)
go frame "Universo"
sendSprite 21, #vaiIcone, tmp
sendSprite 120, #finalizaAnima
updateStage
end if
-- Verbetes
else if menuSel = 5 then
-- put submenuSel
if submenuSel = 0 then
if (subMenu <> 0) then
set the visibility of sprite (spr+subMenu+3) to false
set the visibility of sprite (spr+8) to false
end if
if (subMenu <> 3) then
set subMenu = 3
set the visibility of sprite (spr+6) to true
set the visibility of sprite (spr+8) to false
else
set subMenu = 0
end if
else
global gAstroAtual, gEquipeAtual, gHeroiAtual
if submenuSel = 300 then
set tmp = gHeroiAtual
else if submenuSel = 301 then
set tmp = gEquipeAtual
else if submenuSel = 302 then
set tmp = gAstroAtual
end if
set submenuSel = 0
set subMenu = 0
set the visibility of sprite (spr+6) to false
set the visibility of sprite (spr+8) to false
vaiPagina tmp, true
end if
-- Saida
else if menuSel = 7 then
if (subMenu <> 0) then
set the visibility of sprite (spr+subMenu+3) to false
set the visibility of sprite (spr+8) to false
set subMenu = 0
end if
sendSprite 120, #chaveSaida, true
end if
end if
cursor -1
end
-- Idle sprite
-- tmp = novo valor de ativo
-- tmp2 = novo valor de menuSel
-- tmp3 = novo valor de submenuSel
on idleSprite me
if not ligado then return
global gMustUpdate, gCritico
if rollOver(spr) or ¼
((not escondido) and rollOver(spr+1)) then
set tmp = true
if escondido then
set tmp2 = 0
set tmp3 = 0
else
put the mouseV into y
put y - (the locV of sprite spr - 55) into y
set tmp2 = y/16
set tmp3 = 0
end if
else
set tmp = false
set tmp2 = 0
set tmp3 = 0
end if
-- Submenu busca
if subMenu = 1 and rollOver(spr+4) then
set tmp = true
set tmp2 = 6
put the mouseV into y
put y - (the locV of sprite (spr+4) + 39) into y
set tmp3 = y/16 + 100
end if
-- Submenu universos
if subMenu = 2 and rollOver(spr+5) then
set tmp = true
set tmp2 = 4
put the mouseV into y
put y - (the locV of sprite (spr+5) - 30) into y
set tmp3 = y/16 + 200
end if
-- Submenu verbetes
if subMenu = 3 and rollOver(spr+6) then
set tmp = true
set tmp2 = 5
put the mouseV into y
put y - (the locV of sprite (spr+6) + 6) into y
set tmp3 = y/16 + 300
end if
-- Submenu apresentacao
if subMenu = 4 and rollOver(spr+7) then
set tmp = true
set tmp2 = 1
put the mouseV into y
put y - (the locV of sprite (spr+7) - 10) into y
set tmp3 = y/16 + 400
end if
-- Se mudou o estado do menu
if (tmp <> ativo) then
set ativo = tmp
set gMustUpdate = true
if ativo then
set the member of sprite spr to member "MPTitulo: Ativado"
if not escondido then
set the member of sprite (spr+1) to member "MenuPrincipal: Ativado"
end if
set gCritico = gCritico + 1
else
set the member of sprite spr to member "MPTitulo: Desativado"
if not escondido then
set the member of sprite (spr+1) to member "MenuPrincipal: Desativado"
end if
set the visibility of sprite (spr+3) to false
set menuSel = 0
set gCritico = gCritico - 1
if subMenu <> 0 then
set the visibility of sprite (subMenu+spr+3) to false
set the visibility of sprite (spr+8) to false
set subMenu = 0
end if
end if
end if
-- Verifica se mudou opcao selecionada do menu
if tmp2 <> menuSel then
set gMustUpdate = true
set menuSel = tmp2
if menuSel = 0 then
set the visibility of sprite (spr+3) to false
else
set the member of sprite (spr+3) to member¼
((the number of member "Ativos MenuPrincipal") - 1 + menuSel)
set the visibility of sprite (spr+3) to true
end if
end if
-- Verifica opcao selecionada em submenus
if tmp3 <> submenuSel then
set gMustUpdate = true
set submenuSel = tmp3
if submenuSel = 0 then
set the visibility of sprite (spr+8) to false
else
if submenuSel < 200 then
set the member of sprite (spr+8) to member¼
((the number of member "SubMenu Ativo Search")-100 +submenuSel)
else if submenuSel < 300 then
set the member of sprite (spr+8) to member¼
((the number of member "SubMenu Ativo Universo")-200 +submenuSel)
else if submenuSel < 400 then
set the member of sprite (spr+8) to member¼
((the number of member "SubMenu Ativo Verbete")-300 +submenuSel)
else
set the member of sprite (spr+8) to member¼
((the number of member "SubMenu Ativo Apresentacao")-400 +submenuSel)
end if
updateStage
set the visibility of sprite (spr+8) to true
end if
end if
end